Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: stop adding command middleware repeatedly #259

Merged
merged 1 commit into from
Jan 8, 2021

Conversation

AllanZhengYP
Copy link
Contributor

When sending the same command multiple times, resolveMiddleware()
will be called many times. So adding serde middleware will throw
error because they are already added into stack. This change
prevents adding the serde middleware repeatedly.

Alternative is moving command middleware to the command constructor,
just like in client(that's why client doesn't have the problem). But
the command middleware also have depdency over client configs
supplied from resolveMiddleware(). So serde middleware and
customizations must live here.

Fixes: aws/aws-sdk-js-v3#1864

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

When sending the same command multiple times, resolveMiddleware()
will be called many times. So adding serde middleware will throw
error because they are already added into stack. This change
prevents adding the serde middleware repeatedly.

Alternative is moving command middleware to the command constructor,
just like in client(that's why client doesn't have the problem). But
the command middleware also have depdency over client configs
supplied from resolveMiddleware(). So serde middleware and
customizations must live here.

ref: aws/aws-sdk-js-v3#1864
@AllanZhengYP AllanZhengYP merged commit c57cca3 into smithy-lang:master Jan 8, 2021
AllanZhengYP added a commit to AllanZhengYP/smithy-typescript that referenced this pull request Jan 27, 2021
This reverts commit c57cca3.

client instance, the command still consumes the configuration of
the previous client interface. This issue is resolved by allowing
adding middleware to the stack without throwing error. So smithy-lang#259 is
no longer needed.
AllanZhengYP added a commit that referenced this pull request Jan 28, 2021
This reverts commit c57cca3.

If a command instance is used by a different client instance, the 
command still consumes the configuration of the previous client
interface. This issue is resolved by allowing adding middleware
to the stack without throwing error. So #259 is no longer needed.
srchase pushed a commit to srchase/smithy-typescript that referenced this pull request Mar 17, 2023
When sending the same command multiple times, resolveMiddleware()
will be called many times. So adding serde middleware will throw
error because they are already added into stack. This change
prevents adding the serde middleware repeatedly.

Alternative is moving command middleware to the command constructor,
just like in client(that's why client doesn't have the problem). But
the command middleware also have depdency over client configs
supplied from resolveMiddleware(). So serde middleware and
customizations must live here.

ref: aws/aws-sdk-js-v3#1864
srchase pushed a commit to srchase/smithy-typescript that referenced this pull request Mar 17, 2023
…" (smithy-lang#267)

This reverts commit c57cca3.

If a command instance is used by a different client instance, the 
command still consumes the configuration of the previous client
interface. This issue is resolved by allowing adding middleware
to the stack without throwing error. So smithy-lang#259 is no longer needed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Can't reuse QueryCommand in loop
3 participants